#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    int n, m;
    cin >> n >> m;
    string s; cin >> s;
    s = ' ' + s;
    vector<int> a(m), b(m);
    for(auto& x : a) cin >> x;
    for(auto& x : b) cin >> x;
    int q; cin >> q;
    vector<int> f(n + 2);
    for(int i = 0; i < q; i++) {
        int x; cin >> x;
        int p = upper_bound(a.begin(), a.end(), x) - a.begin() - 1;
        f[min(x, a[p] + b[p] - x)]++, f[max(x, a[p] + b[p] - x) + 1]--;
    }
    for(int i = 1; i <= n; i++) {
        f[i] += f[i - 1];
    }
    for(int i = 0; i < m; i++) {
       int l = a[i], r = b[i];
       for(int j = l; j <= (l + r) / 2; j++) {
            if(f[j] & 1) {
                swap(s[j], s[l + r - j]);
            }
       }
    }
    for(int i = 1; i < s.size(); i++) {
        cout << s[i];
    }
    cout << '\n';
    
}

signed main() {
    int t;
    cin >> t; while(t--) solve();
    return 0;
}